//
// Created by root on 2019/10/14.
//

#ifndef AOA_AOAMANAGER_H
#define AOA_AOAMANAGER_H

#include "HotPlug.h"
#include "PhoneBase.h"
#include "AOAaudio.h"

class AOAManager : private HotPlug {
public:
    AOAManager();

    virtual ~AOAManager();

    void quit();

    void sentAndroidKey(int key);

    void attachAoaDevice(weak_ptr<AOAaudio> aoa);

    void deattachAoaDevice();

    void run(){
        // block here
        waitPhoneIn();
    };

private:
    void setDev(libusb_device *dev, int i) override;

    vector<PhoneBase *> m_mode;
    mutex m_Keylock;

    typedef void ( *KeyFunc )(AOAManager *, int);

    KeyFunc m_fKey;
    weak_ptr<AOAaudio> m_wkAoa;
};


#endif //AOA_AOAMANAGER_H
